import logging


from common.base import BasePage
from common.uitls.doLog import DoLog

dolog = DoLog()
dolog = dolog.ste_get_logger(logging.INFO)
from selenium.webdriver.common.by import By




class AddAddress(BasePage):
    sheng = (By.XPATH, '//select[@name="province" and @id="selProvinces_1"]')
    sheng2 = (By.XPATH, '//*[@id="selProvinces_1"]/option[17]')
    shi1=(By.XPATH, '//select[@name="city" and @id="selCities_1"]')
    shi2=(By.XPATH, '//*[@id="selCities_1"]/option[2]')
    qu1=(By.XPATH, '//select[@name="district" and @id="selDistricts_1"]')
    qu2=(By.XPATH, '//*[@id="selDistricts_1"]/option[5]')
    name=(By.CSS_SELECTOR,'input[name="consignee"][id="consignee_1"]')
    address=(By.CSS_SELECTOR,'input[name="address"][id="address_1"]')
    tel=(By.XPATH, '//input[@name="tel" and @id="tel_1"]')
    email=(By.XPATH, '//input[@name="email" and @id="email_1"]')
    addaddress=(By.XPATH, '//input[@type="submit"and @value="新增收货地址"]')
    def add_address(self,username2,address2,tel2):


        self.getElement(self.sheng)

        self.getElement(self.sheng2).click()

        self.getElement(self.shi1).click()
        self.getElement(self.shi2).click()

        self.getElement(self.qu1).click()
        self.getElement(self.qu2).click()

        self.getElement(self.name).send_keys(username2)
        self.getElement(self.address).send_keys(address2)
        self.getElement(self.tel).send_keys(tel2)
        self.getElement(self.email).click()
        self.getElement(self.addaddress).click()


        #点击我的账户

        #点击收货地址

        #选择配送区域中的省

        #选择配送区域中的市

        #选择配送区域中的区

        #填写收货人姓名

        #填写详细地址

        #填写电话


        #填写电子邮箱地址


        #点击新增收货地址

if __name__ == '__main__':

    add_address = AddAddress()
    add_address.add_address('19522415364','Aa123456','http://192.168.136.131/',"西瓜虫","汝河路","1666666")
